package com.lagou.sqlsession;

import com.lagou.config.XmlConfigBuilder;
import com.lagou.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(InputStream inputStream) throws PropertyVetoException, DocumentException {
        XmlConfigBuilder builder = new XmlConfigBuilder();
        Configuration configuration = builder.parseConfiguration(inputStream);

        return new DefaultSqlSessionFactory(configuration);
    }
}
